import request from '@/utils/request'
import {SERVICE_URL} from '@/config/index.js'

//  用户实名认证
export function realNameAuth (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/member/real-name-auth',
		data
	})
}

//  获取会员信息
export function getMemberInfo (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/info',
		data
	})
}


//  登录 根据 uid 返回 accessToken
export function loginByUid (data) {
	return request.get({
		url: SERVICE_URL + '/v1/site/login-by-uid',
		data
	})
}

//  根据手机号判断是否有账号，没有账号自动注册
export function getUserByPhone (data) {
	return request.get({
		url: SERVICE_URL + '/v1/site/get-user-by-phone',
		data
	})
}

//  微信小程序消息解密
export function decryptedData (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/member/decrypted-data',
		data
	})
}

//  更新用户信息
export function updateUserInfo (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/member/update-info',
		data
	})
}

//  更新用户头像
export function updateHeadImg (filePath) {
	return request.upload({
		url: SERVICE_URL + '/v1/member/member/update-head-img',
		filePath
	})
}

//  分页获取用户消息
export function getUserMessagePage (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/message-user',
		data
	})
}
//  分页获取用户消息
export function getUserMessagePage1 (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/message',
		data
	})
}

//  获取用户消息详情
export function getUserMessageInfo (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/message-info',
		data
	})
}
//  账户
export function frequencyInfo (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/login-frequency',
		data
	})
}

// 查询用户自动化交易功能状态
export function getAutomatedTradingStatus () {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/user-state'
	})
}

// 自动化交易查询期货公司
export function getStrategyCompanyList (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/futures-company'
	})
}

// 自动化交易申请账户资料填写
export function postStrategyAccount (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/member/bind-account',
		data
	})
}

// 自动化交易申请账户资料查询
export function postStrategyAccountGet (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/merchandiser',
		data
	})
}

// 自动化交易设置跟单规则
export function postStrategyRule (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/member/rule',
		data
	})
}

// 自动化交易设置跟单规则-获取合约各类列表
export function getTradeStrategyFutures () {
	return request.get({
		url: SERVICE_URL + '/v1/trade/strategy/futures'
	})
}

// 上传图片
export function uploadImage (filePath) {
	return request.upload({
		url: SERVICE_URL + '/v1/member/member/up-image',
		filePath
	})
}

// 手动关闭自动化交易功能
export function changeAutoStatus (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/change-switch',
		data
	})
}

// 查询自动化交易相关协议
export function getProtocol () {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/protocol'
	})
}

// 查询已订阅策略
export function getStrategyList (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/strategy',
		data
	})
}

// 修改已订阅策略规则开关
export function changeStrategyStatus (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/change-rule-one',
		data
	})
}

// 查询已订阅策略规则详情
export function getRulesDetail (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/member/rule-info',
		data
	})
}

//查询账户资料
export function getAccountDetail () {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/member-info'
	})
}

//查询支付可选项
export function getPayOption () {
	return request.get({
		url: SERVICE_URL + '/v1/member/auto-pay/list'
	})
}

//自动化交易-支付
export function createOrderInfo (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/auto-pay/pay',
		data
	})
}

//自动化交易-支付订单查询
export function getOrderInfo(id) {
	return request.get({
		url: SERVICE_URL+ '/v1/member/auto-pay/auto-order-info',
		data: {id}
	})
}

//账户详情
export function getAccountInfo () {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/member-detail'
	})
}

//持仓记录
export function positionList () {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/strategy-positions'
	})
}

//委托记录
export function entrustList (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/entrust-order',
		data
	})
}

//成交记录
export function insterList (data) {
	return request.get({
		url: SERVICE_URL + '/v1/member/member/inster-order',
		data
	})
}

//更换绑定账户密码
export function changeAccount (data) {
	return request.post({
		url: SERVICE_URL + '/v1/member/member/change-bind-account',
		data
	})
}

//获取用户信息详情
export function getSiteMemberInfo () {
	return request.get({
		url: SERVICE_URL + '/v1/site/member-info'
	})
}